package com.seehope.function;

public class Demo7 {
	
	
	
	public static int sum(int n) {
		if(n==1) {
			return 1;
		}
		return n+sum(n-1);
	}
	//sum(1) =1
	//sum(2) 2+sum(1)=2+1
	
	public static int chen(int n) {
		if(n==1) {
			return 1;
		}
		return n*chen(n-1);
	}


	public static void main(String[] args) {
		System.out.println(sum(100));
		System.out.println(chen(5));

	}

}
